$(document).ready(function(){
//function to open login modal dialog
   
    // show a spinner or something via css
    var login_dialog = $('<div id="login-dialog-id" style="display:none; height: 200px; min-height: 109px; width: auto;" class="ui-dialog-content ui-widget-content"></div>').appendTo('body');

	$('a.login-link-class').click(function() {
            var url = this.href;
            // open the dialog
            login_dialog.dialog({
                // add a close listener to prevent adding multiple divs to the document
                close: function(event, ui) {
                    // remove div with all data and events
                	login_dialog.remove();
                },
                modal: true,
                height: 500,
                width: 450,
                position: 'center'
                
            });
            // load remote content
            login_dialog.load(
                url, 
                {}, // omit this param object to issue a GET request instead a POST request, otherwise you may provide post parameters within the object
                function (responseText, textStatus, XMLHttpRequest) {
                    // remove the loading class
                	login_dialog.removeClass('loading');
                }
            );
            //prevent the browser to follow the link
            return false;
        });
   
    
  //function to open register modal dialog
    var register_dialog = $('<div id="register-modal-dialog-id" style="display:none; height: 200px; min-height: 109px; width: auto;" class="ui-dialog-content ui-widget-content"></div>').appendTo('body');

        $('a.register-link-class').click(function() {
            var url = this.href;
            // show a spinner or something via css
            // open the dialog
            register_dialog.dialog({
                // add a close listener to prevent adding multiple divs to the document
                close: function(event, ui) {
                    // remove div with all data and events
                	register_dialog.remove();
                },
                modal: true,
                height: 450,
                width: 550,
                position: 'center'
                
            });
            // load remote content
            register_dialog.load(
                url, 
                {}, // omit this param object to issue a GET request instead a POST request, otherwise you may provide post parameters within the object
                function (responseText, textStatus, XMLHttpRequest) {
                    // remove the loading class
                	register_dialog.removeClass('loading');
                }
            );
            //prevent the browser to follow the link
            return false;
        });
   
    
       
});
function closeDialog(){
	alert('hiiiiiii');
	var di=$('#login-dialog-id');
	alert(di.dialog('isOpen'));
	di.dialog('close');
	
	
}  

